<?php 
class ProductAction extends BaseAction 
{
	public function index() {
		
		$id = $_GET['id'];
		$article = D('Article')->relation(true)->find($id);
		$comment = D('Comment')->relation(true)->where('aid='.$id)->findAll();
		$this->assign('article', $article);
		$this->assign('comments', $comment);
//		dump($article);
		$this->display();
	}
	public function view(){
		$this->display();
	}
	public function newpost(){

		$Comment=D("Comment");
        if($Comment->create()) {
        	Load('extend');
        	$Comment->ip = get_client_ip();
        	$Comment->uid = $_SESSION[C('USER_AUTH_KEY')];
        	$Comment->postdate = time();
            if($Comment->add()){ 
//            	$this->assign('jumpUrl',__URL__);
				$this->success(L('_INSERT_SUCCESS_'));
            }else{ 
                $this->error(L(_INSERTFAIL)); 
            } 
        }else{ 
            $this->error($Comment->getError()); 
        } 
	}
	
}
?>